package likou;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2021/10/10 10:51
 */
public class _441 {
    public static void main(String[] args) {
        _441 o = new _441();
        System.out.println(o.arrangeCoins(2147483647));
    }
    public int arrangeCoins(int n) {
        long now =  n;
        now *= 2;
        double p = Math.pow(now, 0.5);
        long q = (long) p;
        for (; ; q++) {
            long qwe = q * (q + 1) / 2;
            if (qwe == n) return (int) q;
            if (qwe > n) return (int) q - 1;
        }
    }
}
